/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.ddtroops.web.rest;

import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Svoboda
 */
public class RestHelpers {

    public static void printErrorMessage(HttpServletResponse response) throws IOException {
        response.getWriter().write("invalid request");
    }

    
    public static boolean isAll(String path) {
        return "/all".equals(path) || "/all/".equals(path);
    }

    public static boolean isRoot(String path) {
        return (path == null) || ("/".equals(path));
    }

    public static String getFirst(String path) {
        return path.substring(1);
    }

    public static boolean isNonnegative(String str) {
        return str.matches("[0-9]+?");
    }
}
